//  This file is part of Swordbible - http://www.swordwarrior.net
//  Copyright (C) 2003-2008 Manu Mital mitalmanu@hotmail.com

//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2, or (at your option)
//  any later version.

//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.

//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software Foundation,
//  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.



#include "StdAfx.h"
#include ".\SwordBiblefonts.h"


CString CSwordBibleFonts::strong_color ;
CString CSwordBibleFonts::morph_color;
CString CSwordBibleFonts::fn_color;


CSwordBibleFonts::CSwordBibleFonts(void)
{
	
}

CSwordBibleFonts::~CSwordBibleFonts(void)
{
}

void CSwordBibleFonts::Load()
{	
	strong_color =		AfxGetApp()->GetProfileString("AFX_TAGSCOLOR", "strong_color", "\\red128\\green0\\blue0");
    morph_color =     AfxGetApp()->GetProfileString("AFX_TAGSCOLOR", "morph_color",  "\\red0\\green0\\blue160");
	fn_color =     AfxGetApp()->GetProfileString("AFX_TAGSCOLOR", "fn_color", "\\red0\\green0\\blue160");

	CString Section = "";

	if(location == AFX_MAINBIBLE)
	 Section	= "BiblePage";

	else if(location == AFX_BOTTOM)
		Section = "Bottom";

	else if(location == AFX_BOTTOMLEFT)
		Section = "BottomLeft";

		else if(location == AFX_DEVOTIONAL)
		Section = "Devotional";

	
	text_facename =		AfxGetApp()->GetProfileString(Section, "text_facename", "Georgia");
    text_facesize =     AfxGetApp()->GetProfileInt(Section, "text_facesize", 28);
	text_color =        AfxGetApp()->GetProfileString(Section, "text_color", "\\red0\\green0\\blue0");
	verse_color =       AfxGetApp()->GetProfileString(Section, "verse_color", "\\red0\\green128\\blue128");
	links_color =       AfxGetApp()->GetProfileString(Section,"links_color", "\\red0\\green128\\blue128");
	bg_color    =       AfxGetApp()->GetProfileString(Section, "bg_color","\\red255\\green255\\blue255" );

}



void CSwordBibleFonts::ConstructRTF()
{
	rtf_header.Format(   "{\\rtf1{\\colortbl;  %s; %s;  %s; %s;  %s; %s; %s; %s; %s; %s; %s;}{\\fonttbl {\\f1 %s;} {\\f2 %s;}}\\f1\\fs%d ",
		verse_color,   //cf1 - color of the verse number in the main bible window
		text_color,    //cf2 - color of the text (sentences) associated with a verse in main bible window
		strong_color,  //cf3 - color of the lemma tags (strong's numbers)
		morph_color,   //cf4 - color of the morphological tags(e.g. Robinson or Thayer)
		fn_color,      //cf5 - color of the text for the footnotes 
		links_color,   //cf6 - color of scripture references
		"\\red0\\green0\\blue0", //cf7 - color of the verse number in the tooltip window 
		"\\red0\\green0\\blue0",  //cf8 - color of the text (sentences) associated with a verse in tooltip window
		"\\red255\\green0\\blue0",  // cf9 - red  Parallel Bible1
		"\\red0\\green0\\blue255",  // cf10 - blue Parallel Bible2
		"\\red0\\green0\\blue0",  // cf11 - green Parallel Bible3
		text_facename,  //f1  - name of font (such as Arial or Verdana) in the main bible window
		text_facename,//f2  - name of font (such as Arial or Verdana) in the tooltip window
		text_facesize);  // text size in half-points

	
}





void CSwordBibleFonts::Save()
{

	AfxGetApp()->WriteProfileString("AFX_TAGSCOLOR", "strong_color", strong_color);
   AfxGetApp()->WriteProfileString("AFX_TAGSCOLOR", "morph_color",  morph_color);
   AfxGetApp()->WriteProfileString("AFX_TAGSCOLOR", "fn_color",  fn_color);

	CString Section = "";

		if(location == AFX_MAINBIBLE)
	 Section	= "BiblePage";

	else if(location == AFX_BOTTOM)
		Section = "Bottom";

	else if(location == AFX_BOTTOMLEFT)
		Section = "BottomLeft";

		else if(location == AFX_DEVOTIONAL)
		Section = "Devotional";

	AfxGetApp()->WriteProfileString(Section, "text_facename", text_facename);
    AfxGetApp()-> WriteProfileInt(Section, "text_facesize", text_facesize);
	AfxGetApp()->WriteProfileString(Section, "text_color", text_color);
	AfxGetApp()->WriteProfileString(Section, "verse_color", verse_color);
	AfxGetApp()->WriteProfileString(Section,"links_color", links_color);
	AfxGetApp()->WriteProfileString(Section, "bg_color", bg_color);

		
	 	
}
